home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / waisretrieve < prev    next >
Text File  |  1995-07-26  |  2KB  |  78 lines

  1. #!/bin/sh
  2. # WIDE AREA INFORMATION SERVER SOFTWARE:
  3. #   No guarantees or restrictions.  See the readme file for the full standard
  4. #   disclaimer.    
  5. #
  6. # A shell script to retrieve a document from the docid.
  7. #
  8. # Author: jonathan@think.com
  9. # Date: Sun Feb 16 1992
  10. #
  11. # Change log:
  12. # $Log: waisretrieve.script,v $
  13. # Revision 1.1  1994/08/05  06:57:45  pfeifer
  14. # Initial revision
  15. #
  16. # Revision 1.3  92/04/28  15:39:21  jonathan
  17. # Added DEBUG option
  18. # Revision 1.2  92/02/16  18:36:12  jonathan
  19. # Modified usage (and test)
  20. # Revision 1.1  92/02/16  18:30:11  jonathan
  21. # Initial revision
  22. #
  23.  
  24. if (test $# -ne 1)
  25. then
  26.  echo "usage: $0 DOC_SPEC"
  27.  echo "  where DOC_SPEC is docid:database[@host[:port]][%type]"
  28.  echo "        docid and database are server specific,"
  29.  echo "        host and port are optional."
  30.  exit 1
  31. fi
  32.  
  33. tdir=/tmp
  34. qfile=$tdir/wr$$.q
  35. sfile=wr$$.src
  36. db=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $1}'`
  37. host=`echo $1 | awk -F: '{print $2}' | awk -F@ '{print $2}'`
  38. id=`echo $1 | awk -F: '{print $1}'`
  39. tcpport=`echo $1 | awk -F: '{print $3}' | awk -F% '{print $1}'`
  40. type=`echo $1 | awk -F% '{print $2}'`
  41. if (test -n "$tcpport")
  42. then
  43.  port=$tcpport
  44. else
  45.  port=210
  46. fi
  47.  
  48. cat >$tdir/$sfile <<EoF
  49. (:source
  50.  :version 3
  51.  :database-name "$db"
  52.  :ip-name "$host"
  53.  :tcp-port $port
  54. )
  55. EoF
  56.  
  57. cat >$qfile <<EoF
  58. (:question :version 2 
  59.   :result-documents 
  60.   ( (:document-id
  61.      :document
  62.      (:document
  63.        :doc-id
  64.        (:doc-id :original-database `stringtoany $db` 
  65.         :original-local-id `stringtoany "$id"` )
  66.        :number-of-bytes -1
  67.        :type "$type"
  68.        :source
  69.        (:source-id :filename "$sfile") ) ) ) ) 
  70. EoF
  71.  
  72. waisq -f $qfile -s $tdir/ -v 1
  73.  
  74. $DEBUG rm $qfile $tdir/$sfile
  75.